9fefb4253cbdd692f2e8b627b0ec8ee0859cbdae,android/src/main/java/com/zxcpoiu/incallmanager/InCallManagerModule.java,InCallManagerModule,startBusytone,#,809

Before Change


            }

            mBusytone = new MediaPlayer();
            mBusytone.setDataSource(reactContext, bundleBusytoneUri);
            // --- Not necessary to check ringer mode, because it is incall
            mBusytone.setLooping(false);
            setMediaPlayerEvents(mBusytone, "mBusytone");
            //mBusytone.setAudioStreamType(AudioManager.STREAM_DTMF);
            mBusytone.setAudioStreamType(AudioManager.STREAM_VOICE_CALL);
            /*
            if (android.os.Build.VERSION.SDK_INT >= 21) {
                mBusytone.setAudioAttributes(

After Change


                return true;
            } else {
                busytoneUri = getBusytoneUri(busytoneUriType);
                if (busytoneUri == null) {
                    Log.d(TAG, "startBusytone(): no available media");
                    return false;    
                }
            }

            mBusytone = new myMediaPlayer();
            data.put("sourceUri", busytoneUri);
            data.put("setLooping", false);
            data.put("audioStream", AudioManager.STREAM_VOICE_CALL);
            /*
            TODO: for API 21
            data.put("name", "mBusytone");
            data.put("audioFlag", AudioAttributes.FLAG_AUDIBILITY_ENFORCED);
            data.put("audioUsage", AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING); // USAGE_VOICE_COMMUNICATION ?
            data.put("audioContentType", AudioAttributes.CONTENT_TYPE_SPEECH);
            */
            setMediaPlayerEvents((MediaPlayer)mBusytone, "mBusytone");
            mBusytone.startPlay(data);
            return true;
        } catch(Exception e) {